package com.xchen.imweb.auth;

import lombok.Data;

@Data
public class Result<T> {
    private int code;
    private T data;
    private String message;

    public static <R> Result<R> ok(R data) {
        Result<R> ret = new Result<>();
        ret.setCode(0);
        ret.setData(data);
        ret.setMessage("ok");
        return ret;
    }

    public static <R> Result<R> error(String message) {
        Result<R> ret = new Result<>();
        ret.setCode(-1);
        ret.setMessage(message);
        return ret;
    }


}
